package keter.web.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RoutesServlet extends HttpServlet {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = LoggerFactory.getLogger(RoutesServlet.class);
		
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String routes = StringUtils.substringAfter(request.getRequestURL().toString(),"/routes");
		logger.info("路由参数:{}",routes);	
		request.getRequestDispatcher("/views/routes.html").forward(request, response);
	}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
    	doGet(request, response);
	}
}